@include("user.head")
	<!-- 公共头部 -->
	<div id="content_person">
	<div class="row">
	<div class="col-xs-3">
		@include("user.uc.navigation")
	</div>
	<div class="col-xs-9">
		<div class="panel panel-default">
		  <div class="panel-heading">
		    <h3 class="panel-title">基本信息</h3>
		  </div>
		  <div class="panel-body">
		  	<div class="form-horizontal">
				<div class="form-group">
					<label for="inputName" class="col-xs-3 control-label no_padding_right">公司名称:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="company_name" id="inputName" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputPerson" class="col-xs-3 control-label no_padding_right">法人代表:</label>
					<div class="col-xs-3">
						<input class="form-control input_size" name="legal_person" id="inputPerson" placeholder="" type="text">
					</div>
			    </div>

			    <div class="form-group">
					<label for="inputRegist" class="col-xs-3 control-label no_padding_right">公司注册时间:</label>
					<div class="col-xs-6 relative_pos">
						<input class="form-control input_size date-time-picker" name="regist_time" readonly id="inputRegist" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputCapital" class="col-xs-3 control-label no_padding_right">注册资本(万元):</label>
					<div class="col-xs-6 fixed_">
						<input class="form-control input_size" name="regist_capital" id="inputCapital" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="select" class="col-xs-3 control-label">注册地址</label>
					<div class="col-xs-6">
						<select class="form-control select_size selects" name="regist_province" id="province">
							<option value="-1">请选择</option>
							@include("user.uc.province_option")
						</select>
						<select class="form-control select_size selects" name="regist_city" id="city">
							<option value="-1">请选择</option>
						</select>

						<select class="form-control select_size selects" name="regist_area" id="area">
							<option value="-1">请选择</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="inputAddress" class="col-xs-3 control-label no_padding_right">详细地址:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="regist_address" id="inputAddress" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputZcode" class="col-xs-3 control-label no_padding_right">邮政编码：</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="zcode" id="inputZcode" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputCode" class="col-xs-3 control-label no_padding_right">营业执照注册号：</label>
					<div class="col-xs-3">
						<input class="form-control input_size" name="regist_code" id="inputCode" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputFax" class="col-xs-3 control-label no_padding_right">传真号:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="fax" id="inputFax" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">LOGO:</label>
					<div class="col-xs-6">
						<a href="javascript:;" class="file btn btn-primary">上传
							<input type="file" name="imgFile" id="logo">
							<input type="hidden" name="logo" id="logoFileName">
						</a>
						<span id="logoName"></span>
					</div>
				</div>

				<div class="form-group">
					<label for="inputGroupCode" class="col-xs-3 control-label no_padding_right">组织机构代码:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="group_code" id="inputGroupCode" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputContactPerson" class="col-xs-3 control-label no_padding_right">联系人:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="contact_person" id="inputContactPerson" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputNumber" class="col-xs-3 control-label no_padding_right">联系人电话:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="contact_number" id="inputNumber" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">联系人邮箱:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="email" id="inputEmail" placeholder="" type="text">
					</div>
				</div>


				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">机构代码证:</label>
					<div class="col-xs-6">
						<a href="javascript:;" class="file btn btn-primary">上传
							<input type="file" name="imgFile" name="" id="codeImg">
							<input type="hidden" name="group_code_img" id="codeFileName">
						</a>
						<span id="codeName"></span>
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">营业执照副本:</label>
					<div class="col-xs-6">
						<a href="javascript:;" class="file btn btn-primary">上传
						<input type="file" name="imgFile" name="" id="copy">
						<input type="hidden" name="regist_copy" id="copyFileName">
					</a>
					<span id="copyName"></span>
				</div>
				</div>

				<div class="form-group">
					<label class="col-xs-3 control-label no_padding_right">企业性质:</label>
					<div class="col-xs-6">
						<div class="radio">
							<label>
								<input name="enterprice_char" id="" value="0" checked="" type="radio">
								民营
							</label>
							<label>
								<input name="enterprice_char" id="" value="1" type="radio">
								国有
							</label>
							<label>
								<input name="enterprice_char" id="" value="2" type="radio">
								中外合资
							</label>
							<label>
								<input name="enterprice_char" id="" value="3" type="radio">
								外商独资
							</label>
						</div>
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">企业办公实景</label>
					<div class="col-xs-6">
						<a href="javascript:;" class="file btn btn-primary">上传
							<input type="file" name="imgFile" id="pic">
							<input type="hidden" name="enterprice_pic" id="picFileName">
						</a>
						<span id="picName"></span>
					</div>
				</div>

				<div class="form-group">
			          <label class="col-xs-3 control-label no_padding_right">描述:</label>
			          <div class="col-xs-6">
			            <textarea class="form-control text_size" name="description" rows="3"></textarea>
			            <span class="help-block"></span>
			          </div>
			        </div>

				<div class="form-group">
					<label for="induction" class="col-xs-3 control-label no_padding_right">简介:</label>
					<div class="col-xs-9">
						<div id="container" style="height:500px;"></div>
					</div>
				</div>

				<div class="form-group">
					<div class="col-xs-12 text-center">
						<button type="button" id="sub" class="btn btn-primary ">提交</button>
					</div>
				</div>
			</div>
		  </div>
		</div>
	</div>
	</div>
	</div>
	<!-- 公共底部 -->
	@include("user.footer")
	@include("user.common")
	<!-- 公共底部 -->
</body>
<script type="text/javascript">
var ue = UE.getEditor('container');

var isAsync;
$.get('edit_groupinfo/list', function(data){
	if(data.success){
		isAsync = false;
		$('input[name=company_name]').val(data.company_name);
		$('input[name=legal_person]').val(data.legal_person);
		$('input[name=regist_time]').val(data.regist_time);
		$('input[name=regist_capital]').val(data.regist_capital);
		$('input[type=radio]').each(function(k, v){
			if($(this).val() == data.enterprice_char){
				$(this).attr("checked", "checked");
			}
		})
		$('select[name="regist_province"]').val(data.regist_province);
		$('select[name="regist_province"]').change();
		$('select[name="regist_city"]').val(data.regist_city);
		$('select[name="regist_city"]').change();
		$('select[name="regist_area"]').val(data.regist_area);

		$('input[name=regist_address]').val(data.regist_address);
		$('input[name=zcode]').val(data.zcode);
		$('input[name=regist_code]').val(data.regist_code);
		$('input[name=fax]').val(data.fax);
		$('input[name=group_code]').val(data.group_code);
		$('input[name=contact_person]').val(data.contact_person);
		$('input[name=contact_number]').val(data.contact_number);
		$('input[name=email]').val(data.email);
		ue.ready(function(){
		    ue.setContent(decodeURIComponent(data.induction));
		});
		$('input[name=group_code_img]').val(data.group_code_img);
		$('input[name=regist_copy]').val(data.regist_copy);
		$('input[name=enterprice_pic]').val(data.enterprice_pic);
		$('input[name=logo]').val(data.logo);
		$("textarea[name='description']").val(data.description);
		isAsync = true;
	}else{

	}
})


$('#pic').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$("#picName").html(filename.filename);
			$("#picFileName").val(filename.filename);
		}
	});

$('#copy').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$("#copyName").html(filename.filename);
			$("#copyFileName").val(filename.filename);
		}
	});

$('#logo').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$("#logoName").html(filename.filename);
			$("#logoFileName").val(filename.filename);
	}
});

$('#codeImg').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$("#codeName").html(filename.filename);
			$("#codeFileName").val(filename.filename);
		}
	});
$(".selects").change(function(){
	_this = $(this);
	var pid = $(this).val();
	$.ajax({
		url : '<% url("uc/address/getarea") %>',
		data : {pid : pid},
		type : "get",
		async: isAsync,
		success:function(data){
			var str = '<option value="-1">请选择</option>';
			$.each(data.area,function(k, v){
				str += '<option value="'+v.area_id+'">'+v.area_name+'</option>';
			})
			_this.next("select").html(str).next("select").html('<option value="-1">请选择</option>');
		}
	})
})


$("#sub").click(function(){
	var company_name = $("input[name='company_name']").val().trim();
	var legal_person = $("input[name='legal_person']").val().trim();
	var regist_time = $("input[name='regist_time']").val().trim();
	var regist_capital = $("input[name='regist_capital']").val().trim();
	var enterprice_char = $("input[name='enterprice_char']:checked").val().trim();
	var regist_province = $("select[name='regist_province']").val().trim();
	var regist_city = $("select[name='regist_city']").val().trim();
	var regist_area = $("select[name='regist_area']").val().trim();
	var regist_address = $("input[name='regist_address']").val().trim();
	var regist_code = $("input[name='regist_code']").val().trim();
	var group_code = $("input[name='group_code']").val().trim();
	var contact_person = $("input[name='contact_person']").val().trim();
	var contact_number = $("input[name='contact_number']").val().trim();
	var email = $("input[name='email']").val().trim();
	var zcode = $("input[name='zcode']").val().trim();
	var fax = $("input[name='fax']").val().trim();
	var group_code_img = $("input[name='group_code_img']").val().trim();
	var enterprice_pic = $("input[name='enterprice_pic']").val().trim();
	var regist_copy = $("input[name='regist_copy']").val().trim();
	var logo = $("input[name='logo']").val().trim();
	var induction = encodeURIComponent(ue.getContent());
	var description = $("textarea[name='description']").val().trim();

	if (company_name == '' || legal_person == '' || regist_time == '' || regist_capital == '' || enterprice_char == '' || regist_province < 1 || regist_city < 1 || regist_address == '' || regist_code == '' ||
		group_code == '' || contact_person == '' || contact_number == '' || email == '' || group_code_img == '' ||
		enterprice_pic == '' || induction == '' || logo == '')
	{
		warning('','必填信息不能为空');
		return false;
	}
	$.post("edit_groupinfo/update", {

	company_name : company_name,
	legal_person : legal_person,
	regist_time : regist_time,
	regist_capital : regist_capital,
	enterprice_char : enterprice_char,
	regist_province : regist_province,
	regist_city : regist_city,
	regist_area : regist_area,
	regist_address : regist_address,
	regist_code : regist_code,
	contact_person : contact_person,
	contact_number : contact_number,
	email : email,
	group_code : group_code,
	group_code_img : group_code_img,
	enterprice_pic : enterprice_pic,
	regist_copy : regist_copy,
	induction : induction,
	fax : fax,
	zcode : zcode,
	logo : logo,
	description : description
	},function (data){
		if(data.success){
			success("", "提交成功");
			setTimeout(function(){
				window.location.reload();
			}, 2000)
		}else{
			warning("", data.msg);
		}
	})
})


</script>
</html>